class Alg<T extends Comparable<T>>{
    public T findMax(T[] array){
        T max = array[0];
        for(int i=0;i<array.length;i++){
            if(max.compareTo(array[i])<0){
                max=array[i];
            }
        }
        return max;
    }
}

public class TestDemo2 {
    public static void main(String[] args) {
        Alg<Integer> alg = new Alg<>();
        Integer[] array = {1,2,3,4};
        System.out.println(alg.findMax(array));
    }
}
